package com.yfree.views;

import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.util.AttributeSet;

import com.yfree.libs.dsbridge.DWebView;

public class YWebView extends DWebView {
    public YWebView(Context context) {
        super(getFixedContext(context));
    }

    public YWebView(Context context, AttributeSet attrs) {
        super(getFixedContext(context), attrs);
    }

    public static Context getFixedContext(Context context) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
            return context.createConfigurationContext(new Configuration());
        } else {
            return context;
        }
    }
}
